﻿using System;

namespace Snake.Gameplay
{
    public partial class GameplayAbilityComponent
    {
        private Action<GameplayEvent> _actions;

        public void RegisterEvent(Action<GameplayEvent> action)
        {
            _actions += action;
        }

        public void UnregisterEvent(Action<GameplayEvent> action)
        {
            _actions -= action;
        }

        public void BroadcastEvent(GameplayEvent evt)
        {
            _actions?.Invoke(evt);
        }
    }
}